//
//  XLHostSideTuijianCell.m
//  XiangLove
//
//  Created by 李传坤 on 2018/5/28.
//  Copyright © 2018年 BAOMIHUA.COM. All rights reserved.
//

#import "XLHostSideTuijianCell.h"

@implementation XLHostSideTuijianCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        self.contentView.backgroundColor = kWhiteColor;
        [self setupView];
    }
    return self;
}

-(void)setupView
{
    
    
        _headerImageView = [[UIImageView alloc] init];
        _headerImageView.layer.cornerRadius = 5;
        _headerImageView.layer.masksToBounds = YES;
        [self.contentView addSubview:_headerImageView];
        [_headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(48, 48));
            make.left.equalTo(self.contentView.mas_left).offset(15);
            make.centerY.equalTo(self.contentView);
        }];
    
    _nickNameLabel = [[UILabel alloc] init];
    _nickNameLabel.font = [UIFont systemFontOfSize:17];
    _nickNameLabel.textColor = RGB_HEX(0x000000);
    [self.contentView addSubview:_nickNameLabel];
    [_nickNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_headerImageView.mas_right).offset(10);
        make.top.equalTo(self.contentView.mas_top).offset(20);
        make.right.equalTo(self.contentView.mas_right).offset(-50);
    }];
    self.levelImage = [[UIImageView alloc]init];
    //    _levelImage.backgroundColor = kWhiteColor;
    [self.contentView addSubview:_levelImage];
    //    [_levelImage mas_makeConstraints:^(MASConstraintMaker *make) {
    //        make.top.equalTo(_nickNameLabel.mas_top).offset(4);
    //        make.left.equalTo(_nickNameLabel.mas_right).offset(10);
    //        make.size.mas_equalTo(CGSizeMake(30, 16));
    //
    //    }];
    _chargeMoney = [[UILabel alloc] init];
    _chargeMoney.textColor = RGB_HEX(0x666666);
    _chargeMoney.font = [UIFont systemFontOfSize:12];
    [self.contentView addSubview:_chargeMoney];
    [_chargeMoney mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_nickNameLabel.mas_bottom).offset(6);
        make.left.equalTo(_nickNameLabel.mas_left);
    }];
    _time = [[UILabel alloc] init];
    _time.text = @"";
    _time.textColor     = kLightGrayColor;
    _time.font = [UIFont systemFontOfSize:12];
    _time.hidden = YES;
    [self.contentView addSubview:_time];
    [_time mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.chargeMoney.mas_right).offset(8);
        make.centerY.equalTo(self.chargeMoney);
    }];
    _stateBgView            = [[UIView alloc] init];
    _stateBgView.layer.masksToBounds = YES;
    _stateBgView.hidden = YES;
    [self.contentView addSubview:_stateBgView];
    [_stateBgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.right.equalTo(self.contentView.mas_right).offset(-12);
        make.size.mas_equalTo(CGSizeMake(30, 19));
    }];
    _state = [[UILabel alloc] init];
    _state.font = [UIFont systemFontOfSize:12];
    _state.hidden = YES;
    [self.contentView addSubview:_state];
    [_state mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView.mas_right).offset(-14);
        make.centerY.equalTo(self.contentView);
        
    }];
    
    UIView * line = [[UIView alloc]init];
    line.backgroundColor = RGB_HEX(0xeeeeee);
    [self.contentView addSubview:line];
    
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_nickNameLabel.mas_left).offset(0);
        make.right.equalTo(self.contentView.mas_right).offset(0);
        make.bottom.equalTo(self.contentView.mas_bottom).offset(0);
        make.height.equalTo(@1);
    }];
    
    UIButton * chatButton = [[UIButton alloc]init];
    [chatButton setBackgroundImage:IMAGE_NAMED(@"video_icon_jieting_n_liao") forState:UIControlStateNormal];
    kWeakSelf(self);
    [chatButton addTapBlock:^(UIButton *btn) {
        if(weakself.chatButtonClickBlock)
        {
            weakself.chatButtonClickBlock();
        }
    }];
    [self.contentView addSubview:chatButton];
    
    [chatButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(36, 36));
        make.right.equalTo(self.contentView.mas_right).offset(-12);
        make.centerY.equalTo(self.contentView.mas_centerY);
    }];
    
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}


@end
